const name = 'earthsdk-icon'
const typescript = require('rollup-plugin-typescript2')
const vuePlugin = require('rollup-plugin-vue')
const nodeResolve = require('@rollup/plugin-node-resolve')
const postcss = require('rollup-plugin-postcss');
const file = (type) => `lib/${name}.${type}.js`

module.exports = { // 这里将 file 方法 和 name 导出
    file,
    name
}

const overrides = {
    compilerOptions: { declaration: true }, // 是否创建 typescript 声明文件
    exclude: ['node_modules', 'src/main.ts']
}

module.exports = {
    input: './packages/index.ts',
    output: {
        name: 'earthsdk-icon',
        file: file('umd'),
        format: 'umd' // 编译模式
    },
    plugins: [
        nodeResolve(),
        typescript({ tsconfigOverride: overrides }),
        vuePlugin(),
        postcss()
    ],
    external: ['vue'] // 依赖模块
}

